#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# 地址：http: //www.runoob.com/python/python-exercise-example97.html

if __name__ == "__main__":
    from sys import stdout

    filename = input("输入文件名:\n")
    fp = open(filename, "w")
    ch = input("输入字符串:\n")
    while ch != "#":
        fp.write(ch)
        stdout.write(ch)
        ch = input("")
    fp.close()
